﻿using System.Windows;

namespace AgFractal
{
    public static class FrameworkElementHelpers
    {
        public static T GetParent<T>(this FrameworkElement element) where T : FrameworkElement
        {
            FrameworkElement p = element.Parent as FrameworkElement;
            while (!(p is T) && (p != null))
                p = p.Parent as FrameworkElement;

            return (T)p;
        }
    }
}
